//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.lyq.bean.mySql;

import com.lyq.bean.Teacher;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

public class SeekAllT_Sql {
    public SeekAllT_Sql() {
    }

    public List<Teacher> seekAllT_Sql(List<Teacher> list) {
        (new MysqlLinking()).getLink();
        Connection conn = MysqlLinking.conn;
        if (conn != null) {
            try {
                String sql = "select * from teacher ";
                PreparedStatement ps = conn.prepareStatement(sql);
                ResultSet rs = ps.executeQuery();

                while(rs.next()) {
                    Teacher t = new Teacher();
                    t.setNo(rs.getString("T_No"));
                    t.setName(rs.getString("T_Name"));
                    t.setSex(rs.getString("T_Sex"));
                    t.setAge(rs.getString("T_Age"));
                    t.setCollage(rs.getString("T_Collage"));
                    list.add(t);
                }
            } catch (Exception var7) {
                Exception e = var7;
                e.printStackTrace();
            }
        } else {
            System.out.println("数据库连接错误！");
        }

        return list;
    }
}
